Package com.fsf.news
Class GuiceExtension
java.lang.Object
com.fsf.news.GuiceExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
public class GuiceExtension
extends Object
implements org.junit.jupiter.api.extension.BeforeEachCallback
A JUnit extension that sets up Guice injection for tests that apply it.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) Injects dependencies into the test instance before each test.
-
Field Details
-
injector
private final com.google.inject.Injector injector
-
-
Constructor Details
-
GuiceExtension
public GuiceExtension()
-
-
Method Details
-
beforeEach
Injects dependencies into the test instance before each test.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Parameters:
context- The extension context for the current test- Throws:
Exception- If an error occurs during injection
-